package Model.Dao;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Random;

import Model.Bean.*;
public class SetTaskDao {
	public static void main(String[] args){
		SetTaskDao sb=new SetTaskDao();
		sb.insertodatabase(sb.SetTask("abcd","abcde", "2011-01-09", "2011-02-10", 20, 90,50,49,60,50,0,10,5));
		
		
	}
	
	public String gettask_id(){
		String taskid=null;
		Date today=new Date();
		DateFormat ssformat=new SimpleDateFormat("yyyyMMddHHmmss");
		Random ra=new Random();
		taskid=ssformat.format(today);
		int a=ra.nextInt(1000);
		taskid=taskid+a;
		return taskid;
	}
	public TaskBean SetTask(String content, String title,
			String startDate,String endDate,
			float reward,float cpp,float Java,float csharp,
			float oracle,float python,float php,int commentnum,
			float averagemark){
		    TaskBean td=new TaskBean();
		    td.setTitle(title);
		    td.setContent(content);
		    td.setStartDate(startDate);
		    td.setEndDate(endDate);
		    td.setReward(reward);
		    td.setCpp(cpp);
		    td.setJava(Java);
		    td.setCsharp(csharp);
		    td.setOracle(oracle);
			td.setPython(python);
			td.setPhp(php);
			td.setCommentnum(commentnum);
			td.setAveragemark(averagemark);
			return td;
	}
	
	public void insertodatabase(TaskBean td){
		Connecttodatabase ct=new Connecttodatabase();
		ct.insertintotask(td);
	}
	
	
	
	
	
}
